﻿using UnityEngine;
using System.Collections;
using System;
public class EmemyWave : MonoBehaviour {
    int count = 0;
    // Use this for initialization
    public static event Action WaveDead;
	void Start () {
        count = transform.childCount;
        StartCoroutine(CheckWaveEnd());
	}
	
	// Update is called once per frame
	IEnumerator CheckWaveEnd()
    {
        while (true)
        {
            yield return new WaitForSeconds(0.5f);
            if (transform.childCount==0)
            {
                StopAllCoroutines();

                Destroy(gameObject);
                WaveDead();
            }
        }
    }
}
